import React from 'react';
import {createStaticNavigation} from '@react-navigation/native';
import {createMaterialTopTabNavigator} from '@react-navigation/material-top-tabs';
import Home from './Home';
import About from './About';
import {SafeAreaProvider} from 'react-native-safe-area-context';
import {Provider} from 'react-redux';
import {store} from '../redux/store.js';

export default function App() {
  const RootStack = createMaterialTopTabNavigator({
    tabBarPosition: 'bottom',
    initialRouteName: 'Home',
    screens: {
      About: {
        screen: About,
        options: {
          title: '关于',
        },
      },
      Home: {
        screen: Home,
        options: {
          title: '首页',
        },
      },
    },
  });

  const Navigation = createStaticNavigation(RootStack);

  return (
    <SafeAreaProvider>
      <Provider store={store}>
        <Navigation />
      </Provider>
    </SafeAreaProvider>
  );
}
